package com.promise.paging

import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView

/**
 * Created by CQNNJ-003 on 2018/6/2.
 */
class UserViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

    private val title : TextView = itemView.findViewById(R.id.tv_title)
    private var post : QuestsData? = null

    init {

    }

    fun bind(data :QuestsData?){
        this.post = data
        title.text = post?.title ?: "loading"
    }

    companion object {
        fun create(parent: ViewGroup): UserViewHolder {
            val view = LayoutInflater.from(parent.context)
                    .inflate(R.layout.item, parent, false)
            return UserViewHolder(view)
        }
    }

    fun updateScore(item: QuestsData?) {
        post = item
    }
}